package com.example.yuntiku.Servlet;

import com.example.yuntiku.dao.impl.TeacherDao;
import com.example.yuntiku.entity.Teacher;

import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.annotation.*;

@WebServlet(name = "IndexServlet", value = "/IndexServlet")
public class IndexServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        Teacher u = (Teacher) request.getSession().getAttribute("user");
        TeacherDao teacherDao=new TeacherDao();
        Teacher teacher=teacherDao.selectById(u.getTid());
        request.setAttribute("teacher", teacher);
        request.getRequestDispatcher("index.jsp").forward(request,response);
    }
}